﻿using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using DevelopmentKit.Enums;

namespace DevelopmentKit.Web.Controllers.ViewModels.UserViewModels
{
    public class CreateUserViewModel
    {
        /// <summary>
        /// 登录名  登录名唯一
        /// </summary>  
        [Display(Name = "登录名")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        [RegularExpression("^[a-zA-Z][a-zA-Z0-9_]{2,15}$", ErrorMessage = "{0}只允许输入3~16个字符，可使用字母、数字、下划线，需以字母开头")]
        public virtual string UserName { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        [Display(Name = "姓名")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        public virtual string Name { get; set; }
        /// <summary>
        /// 手机号码
        /// </summary>
        [Display(Name = "手机号码")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(32, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        [RegularExpression("1\\d{10}", ErrorMessage = "不是合法的{0}格式,正确格式：13560123123")]
        public virtual string Mobile { get; set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        [Display(Name = "邮箱")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(255, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        [RegularExpression("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*", ErrorMessage = "不是合法的{0}格式,正确格式：username@qq.com")]
        public virtual string Email { get; set; } 
        /// <summary>
        /// 密码
        /// </summary>
        [Display(Name = "密码")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(225, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        public virtual string Password { get; set; }
        /// <summary>
        /// 确认密码
        /// </summary>
        [Display(Name = "密码确认")]
        [Required(ErrorMessage = "{0}不能为空")]
        [StringLength(225, ErrorMessage = "{0}不能超过{1}个字符", MinimumLength = 0)]
        [Compare("Password", ErrorMessage = "两次密码输入不一致")]
        public virtual string RePassword { get; set; }
        /// <summary>
        /// 用户角色
        /// </summary>
        [Display(Name = "用户角色")]
        [Required(ErrorMessage = "{0}不能为空")]
        public int[] Roles { get; set; }


        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别")]
        public virtual int Sex { get; set; }
         

    }
}